
var login = require('/utils/login.js');
var util = require('/utils/util.js');
const { request } = require('./utils/request.js');
App({
  resthttp: request,
  onLaunch: function (e) {
    console.log('onLaunch',e);
    var that = this;
    let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
    console.log(extConfig);
    var storeId = extConfig.StoreId;
    that.globalData.storeId = storeId
    that.globalData.storeAppId = extConfig.StoreAppId;
    that.globalData.image300_300host = 'https://static.711688.net.cn/upload/store/' + storeId + '/product/show/thumb300_300/';
    that.globalData.image190_190host = 'https://static.711688.net.cn/upload/store/' + storeId + '/product/show/thumb190_190/';
    that.globalData.image800_800host = 'https://static.711688.net.cn/upload/store/' + storeId + '/product/show/thumb800_800/';
    that.globalData.image_logo_host = 'https://static.711688.net.cn/upload/store/' + storeId + '/classes/thumb70_70/';
    that.globalData.image_source = 'https://static.711688.net.cn/upload/store/' + storeId + '/product/show/source/';
    that.globalData.image_logo_banner = 'https://static.711688.net.cn/upload/store/' + storeId + '/widget/',
      that.globalData.image_logo_class = 'https://static.711688.net.cn/upload/store/' + storeId + '/classes/source/';
    if (extConfig.showAppoint) {
      that.showAppoint = extConfig.showAppoint;
    }
    if (extConfig.swiper_h) {
      that.swiper_h = extConfig.swiper_h;
    }
    that.getDefaultStaffCallback = () => {
      util.getDefaultStaff();
    }
    wx.request({
      url: that.globalData.host + '/api/store/GetInfo',
      data: {
        id: that.globalData.storeId
      },
      success: function (res) {
        wx.setStorageSync('mallName', res.data.Data.Name);
        wx.setStorageSync('logoSrc', res.data.Data.Logo);
      }
    })
  },
  onShow: function (e) {
    // login.login(this);
    if (e.scene != 1154) {//朋友圈分享不登陆
      login.login(this);
    }
  },
  onHide: function () {
    console.log("onHide")
    wx.removeStorageSync('tabBarObj')
  },
  globalData: {
    //版本
    version: '2.0.2',
    //用户头像
    userInfo: null,
    //店铺ID
    storeId: 0,
    storeAppId: 0,
    diningSid:0,
    userStaff: null,//默认名片人信息
    host: 'https://weapp.711688.net.cn',
    // host: 'https://weapp-slave.711688.net.cn',
    socketUrl: 'wss://im-socket.711688.net.cn/wss',
    webhost: 'https://weijieke.711688.net.cn/admin_wjk/pages/', //网页跳传域名
    
    //注意地址中含有特定店铺ID，请更换
    fenxiao_code: 'https://static.711688.net.cn/upload/user/',
    image300_300host: 'https://static.711688.net.cn/upload/store/0/product/show/thumb300_300/',
    image190_190host: 'https://static.711688.net.cn/upload/store/0/product/show/thumb190_190/',
    image800_800host: 'https://static.711688.net.cn/upload/store/0/product/show/thumb800_800/',
    image_logo_host: 'https://static.711688.net.cn/upload/store/0/classes/thumb70_70/',
    image_source: 'https://static.711688.net.cn/upload/store/0/product/show/source/',
    image_logo_banner: 'https://static.711688.net.cn/upload/store/0/widget/',
  }
})